package rmmk.algorithms.features.abstraction;

import java.util.HashMap;

import rmmk.framework.datasources.Document;

/**
 * Klasa abstrakcyjnego ekstraktora
 * @author marcin
 *
 */
public abstract class AbstractFeatureExtractor {
	
	public AbstractFeatureExtractor(){
		cache.clear();
	}
	
	private HashMap<Document, Double[]> cache = new HashMap<>();
	
	//private double[] featureValue = null;
	public Double[] calculate(Document document){
		if(cache.containsKey(document))
			return cache.get(document);
		else{
			Double[] resp = doCalculate(document);
			cache.put(document, resp);
			return resp;
		}
	}
	
	public abstract Double[] doCalculate(Document document);
	public abstract int getFeatureSize();
	
	/*public double[] getFeatureValue(){
		return this.featureValue;
	}*/
}
